package com.jspxcms.plug.service.impl;

import com.jspxcms.plug.domain.PlugDoctorDisease;
import com.jspxcms.plug.repository.PlugDoctorDiseaseDao;
import com.jspxcms.plug.service.PlugDoctorDiseaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

@Service
@Transactional(readOnly = true)
public class PlugDoctorDiseaseServiceImpl implements PlugDoctorDiseaseService {


	private PlugDoctorDiseaseDao dao;

	@Autowired
	public void setDao(PlugDoctorDiseaseDao dao) {
		this.dao = dao;
	}

    @Override
    public List<PlugDoctorDisease> findByFDoctorId(Integer fDoctorId) {
        return dao.findByDoctorId(fDoctorId);
    }

    @Override
    public PlugDoctorDisease save(PlugDoctorDisease bean) {
        return dao.save(bean);
    }

    @Override
    public int deleteByFDoctorId(Integer fdoctorId) {
        ArrayList doctors = new ArrayList<Integer>();
        doctors.add(fdoctorId);
        return dao.deleteByDoctorIds(doctors);
    }
}
